#pragma once
#include "FAQ.h"
#include "algorithms/ialgorithm/FAQCipherAlgorithm.h"
#include "mode/Mode.h"
#include "padding/Padding.h"
#include "FAQBaseCipher.h"
#include "keys/FAQKey.h"

namespace yzrilyzr_crypto{
	ECLASS(FAQCipher, public FAQBaseCipher){
	public:
	static constexpr int ENCRYPT_MODE=1;
	static constexpr int DECRYPT_MODE=2;
	private:
	std::shared_ptr<Mode> mode=nullptr;
	std::shared_ptr <Padding> padding=nullptr;
	int encMode=0;
	yzrilyzr_array::ByteArray iv;
	std::shared_ptr<FAQCipherAlgorithm> algorithm=nullptr;
	u_index tagLength=0;
	public:
	FAQCipher();
	void onUpdate()override;
	void doFinal() override;
	void reset()override;
	u_index getBlockSize()const override;
	void setTagLength(u_index tagLength);
	void setIV(const yzrilyzr_array::ByteArray & iv);
	void setIV(const yzrilyzr_array::ByteArray & iv1, u_index off, u_index len);
	void init(const yzrilyzr_lang::String &transform, int encmode,const FAQKey &key);
	u_index getOutputSize(u_index inLen)const;
	void updateAAD(const yzrilyzr_array::ByteArray & input);
	void updateAAD(const yzrilyzr_array::ByteArray & input, u_index offset, u_index length);
	using FAQBaseCipher::doFinal;
	};
}